<?php
session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	header("Location: login.php");

$user = $_SESSION['user'];

$result = mysql_query("SELECT * FROM user WHERE id = $user");
$row = mysql_fetch_array($result);

if($row['type'] != 2)
	header("Location: home.php");

if(!isset($_GET['id']))
{
	header("Location: booster-applications.php");
}

$id = mysql_real_escape_string($_GET['id']);

?>
<!doctype html>
<html>
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0">
    <link rel="icon" href="http://www.veteranboosters.com/wp-content/uploads/2014/04/favicon4.png" type="image/x-icon"/>
    <link rel="shortcut icon" href="http://www.veteranboosters.com/wp-content/uploads/2014/04/favicon4.png" type="image/x-icon"/>
  <!-- Always force latest IE rendering engine or request Chrome Frame -->
  <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,800">

  <!-- Use title if it's in the page YAML frontmatter -->
  <title>Veteran Boosters Order Tracking</title>

  <!--[if lt IE 9]>
  <script src="../../javascripts/vendor/html5shiv.js" type="text/javascript"></script>
  <script src="../../javascripts/vendor/excanvas.js" type="text/javascript"></script>
  <![endif]-->
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/font-awesome.css" />
<link rel="stylesheet" href="css/fullcalendar.css" />
<link rel="stylesheet" href="css/jquery.jscrollpane.css" />	
<link rel="stylesheet" href="css/unicorn.css" />
  <link href="stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
  <script src="javascripts/application.js" type="text/javascript"></script>
</head>

<?php
	include("top.php");
?>

  <div class="container-fluid padded">
    <div class="row-fluid">

      <!-- Breadcrumb line -->
<div id="breadcrumb" >
	<a href="/" title="" class="tip-bottom" data-original-title="Go to Home"><i class="fa fa-home"></i> Home</a>
	<a href="#">Members</a>
	<a href="#" class="current">Booster applications      </a>
</div>

    </div>
  </div>

  <div class="container-fluid padded">
  <?php
		$result = mysql_query("SELECT * FROM booster_application WHERE id = ".$id);

		while($row = mysql_fetch_array($result))
		{
			echo '
  <div class="row-fluid">
   <div class="span12">
      <div class="box">
         <div class="box-header">
            <span class="title">Applicant</span>
         </div>
         <div class="box-content">
            <table class="table table-normal">
               <thead>
                  <tr>
                     <td>Field</td>
                     <td>Value</td>
                  </tr>
               </thead>
               <tbody>';

			   echo '<tr><td>Name</td><td>'.$row['name'].'</td></tr>';
			   echo '<tr><td>Skype</td><td>'.$row['skype'].'</td></tr>';
			   echo '<tr><td>Paypal email</td><td>'.$row['email'].'</td></tr>';
			   echo '<tr><td>IP Address</td><td>'.$row['ip_address'].'</td></tr>';
			   echo '<tr><td>Lolking link</td><td>'.$row['lolking'].'</td></tr>';
			   echo '<tr><td>Region</td><td>'.$row['region'].'</td></tr>';
			   echo '<tr><td>Highest boostable division</td><td>'.$row['elo'].'</td></tr>';
			   echo '<tr><td>Interested in</td><td>'.$row['interested'].'</td></tr>';
			   echo '<tr><td>Forum feedback or vouches</td><td>'.$row['feedback'].'</td></tr>';
			   echo '<tr><td>Comments</td><td>'.$row['comments'].'</td></tr>';

			   if($row['approved'] == 0)
					echo '<tr><td><a href="decline_booster.php?id='.$row['id'].'" class="btn btn-success btn-xs">Decline</a></td><td><a href="approve_booster.php?id='.$row['id'].'" class="btn btn-success btn-xs">Approve</a></td></tr>';

			echo '
			   </tbody>
            </table>
         </div>
      </div>
   </div>
</div>';
		}
?>
</div>
<script>
function update_button (id)
{
	var row = document.getElementById("option_"+id);
	var value = row.children[1].children[0].value;
	var url = "update_options.php?id="+id+"&value="+value;
	row.children[2].children[0].href = url;
}
</script>
</div>
<?php
	include("bottom.php");
?>
